﻿<?php
require_once(dirname(__FILE__)."/../config/session.php");
//require_once("yz.php");
require_once(dirname(__FILE__)."/../config/config.inc.php");
require_once(dirname(__FILE__)."/../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../libs/dbclass/dbconn.php");
require_once(dirname(__FILE__)."/../libs/dbclass/dbservice.php");
require_once(dirname(__FILE__)."/../libs/login/login.php");
require_once(dirname(__FILE__)."/../libs/io/fileclass.php");
$mc=new libstr();
$db=new dbconn();
$dbs=new dbservice();
$lp=new login();
$fil=new fileclass();
//set_time_limit(0);
//ob_implicit_flush();

if($mc->Ismp($_POST["codeid"])!="")
{
    $kop2=$db->dvstr("select topicname,id,price_free,codeid,durl from product_content where codeid=".$_POST["codeid"]."");
	// if($kop2["price_free"]==0)
	// {
	 if($mc->Ismp($_POST["userno"])=="" && $mc->Ismp($_POST["password"]))
{ 
echo "0|userno or password is null";
exit();
}

$mb=$db->ds("select * from member_content where userno='".trim($_POST["userno"])."'");
	if($mb[0]["password"]!=$mc->Ismp($_POST["password"]))
	{
	echo "1|userno or password is wrong";
	exit();
	
	}
	   //$kj=$db->ds("select * from cart_content where zhuangtai >=2 and  userno =".$_POST["userno"]." and codeid =".$_POST["codeid"]);
//	   if(count($kj)==0){
//	  exit("2|no pay");
//	  }
 //}
 
	$fname1=trim(strtolower($kop2["durl"]));
	if(ereg("http:",$fname1)==1){
	
	}else{
	 $kom=split("uploadfile",$fname1);
	$fname1="/uploadfile".$kom[1];
	$fname1=trim($fname1);
	$fname1="http://mtsl.job688.net".$fname1;
	
	if(ereg("zip",$fname1)==1){
	    $shuzi=split("\.",$fname1);
		$js2=count($shuzi);
		$kzm=$shuzi[$js2-2];
		$zsm=$shuzi[$js2-3];
		$pppp=split("\/",$fname1);
		$pppp1=$pppp[count($pppp)-1];
		$pppp1=trim(str_replace($pppp1,"",$fname1));
		$fname1=$pppp1.$zsm.".".$kzm;
		$fname1=str_replace(" ","",$fname1);
		 echo ($fname1);
		 exit();
	}
	}
	//$fname1=str_replace("'","",$fname1);
	
		if($mc->Ismp($fname1)=="")
	{
		echo "4|file is wrong";
		
		exit();
	}
	//exit("http://mtsl.job688.net/uploadfile/files/20130424/1366797489/main.swf");
   // $thefilepath1=$fil->getrootdirpath().$fname1;
    //if($fil->file_exit($thefilepath1))
//	{
//		echo $fname1;
//		$mysqlstr="update product_content set dhit=dhit+1 where codeid =".$_POST["codeid"];
//		$db->cmd($mysqlstr);
//		exit();
//	}
	//if(!$fil->file_exit($thefilepath1))
//	{
//		echo "4|file is wrong";
//	    //echo $thefilepath1;
//		exit();
//	}
    // if($fil->file_copy($thefilepath1,iconv("UTF-8","gb2312", $thefilepath3))){
	  // echo "3|fileurl=".$mc->gethost().$fname1;
	  echo ($fname1);
	  // $mysqlstr="update product_content set dhit=dhit+1 where codeid =".$_POST["codeid"];
	   exit();
		//}
}else
{
echo "5|codeid is null";
}

?>